package com.cn.wanxi.dao.impl;

import com.cn.wanxi.dao.ICompanyDao;
import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.util.GetSqlSession;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

/**
 * 1.编写sql语句
 * 2.调用JDBC
 * 3.返回结果集
 */
public class CompanyImpl implements ICompanyDao {

    @Override
    public CompanyModel getCompanyModel() {
        CompanyModel companyModel = GetSqlSession.getSqlSession().selectOne("com.cn.wanxi.dao.ICompanyDao.getCompanyModel");
        GetSqlSession.commit();
        return companyModel;
    }

    @Override
    public int add(CompanyModel companyModel) {
        return 0;
    }

    @Override
    public int update(CompanyModel companyModel) {
        return 0;
    }

    @Override
    public int del(CompanyModel companyModel) {
        return 0;
    }

    @Override
    public List<CompanyModel> findAll() {
        return GetSqlSession.getSqlSession().selectList("com.cn.wanxi.dao.ICompanyDao.findAll");
    }

    @Override
    public CompanyModel findById(CompanyModel companyModel) {

        return GetSqlSession.getSqlSession().selectOne("com.cn.wanxi.dao.ICompanyDao.findById");
    }

    @Override
    public List<CompanyModel> findBySome(CompanyModel companyModel) {

        return null;
    }
}
